package xgenerator.generators.jgenerator;

import java.io.File;

import xgenerator.generators.AbstractGenerator;
import xgenerator.model.ModelMetadata;
import xgenerator.util.StringUtils;

/**
 * <p>
 * Title:JGenerator
 * </p>
 * <p>
 * Description:具体功能见各方法描述
 * </p>
 * <p>
 * Copyright:Copyright (c) 2012
 * </p>
 * 
 * @author <a href="mailto:lishushan@gmail.com">liss</a>
 * @version 1.0
 */
public abstract class JGenerator extends AbstractGenerator {
	
	/*
	 * 文件扩展名
	 */
	public static final String JAVA_EXT = ".java";
	
	
	/**
	 * <p>
	 * Title：拼路径
	 * </p>
	 * <p>
	 * Description：如：aa.bb.cc包的路径为aa/bb/cc
	 * </p>
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 * @param modelMetadata
	 * @return 包路径
	 */
	protected String buildPackagePath(String packageName) {
		String packagePath = "";
		
		if(StringUtils.isNotBlank(packageName)) {
			if("\\".equals(File.separator)) {
				packagePath = packageName.replaceAll("\\.", File.separator + File.separator);
			} else {
				packagePath = packageName.replaceAll("\\.", File.separator);
			}
		}
		
		return packagePath;
	}
	
}
